import axios from "axios";
// ----------------------------------------------------------------------------------------------------------------【用户管理】
// 获取会员列表头
let getHeaders = (params) => axios.get("/user/user/type_header", { params });
// 获取用户列表
let getUserList = (params) => axios.get("/user/user", { params });
// 获取用户标签
let getUserLabel = (uid) => axios.get(`/user/label/${uid}`);
// 获取添加用户分组表单
let userInsertForm = () => axios.get("/user/user/create");
// 添加用户
let insertUser = (data) => axios.post("/user/user", data);
// 用户详情
let getUserInfo = (id) => axios.get(`/user/user/${id}`);
// 用户详情中（积分、消费、签到等信息）
let getUserOneInfo = (id, params) =>
  axios.get(`/user/one_info/${id}`, { params });
// ----------------------------------------------------------------------------------------------------------------【用户分组】
// 获取用户分组列表
let getUserGroupList = (params) =>
  axios.get("/user/user_group/list", { params });
// 删除分组
let deleteGroup = (id) => axios.delete(`/user/user_group/del/${id}`);
// 添加、修改分组
let saveGroup = (data) => axios.post("/user/user_group/save", data);
// 获取添加、修改分组表单
let saveGroupForm = (id) => axios.get(`/user/user_group/add/${id}`);
// ----------------------------------------------------------------------------------------------------------------【用户标签】
// 获取用户标签列表
let getUserLabelList = (params) => axios.get("/user/user_label", { params });
// 获取标签分类（全部）
let getLabelCateAll = (params) =>
  axios.get("/user/user_label_cate/all", { params });
// 用户标签添加/编辑表单
let labelForm = (id) => axios.get(`/user/user_label/add/${id}`);
// 添加/修改标签
let saveLabel = (data) => axios.post("/user/user_label/save", data);
// 删除用户标签
let deleteLabel = (id) => axios.delete(`/user/user_label/del/${id}`);
// 获取标签分类创建表单
let labelCateCreateForm = () => axios.get("/user/user_label_cate/create");
// 获取标签分类编辑表单
let labelCateEditForm = (id) => axios.get(`/user/user_label_cate/${id}/edit`);
// 保存用户标签分类
let saveCate = (data) => axios.post("/user/user_label_cate", data);
// 编辑用户标签分类
let editCate = (id, data) => axios.put(`/user/user_label_cate/${id}`, data);
// 删除用户标签分类
let deleteCate = (id) => axios.delete(`/user/user_label_cate/${id}`);

// ----------------------------------------------------------------------------------------------------------------【用户等级】
// 获取用户等级列表
let getUserLevelList = (params) =>
  axios.get("/user/user_level/vip_list", { params });
// 设置等级的显示和隐藏
let setShow = (id, is_show) =>
  axios.put(`/user/user_level/set_show/${id}/${is_show}`);
// 获取创建等级表单
let levelCreateForm = (params) =>
  axios.get("/user/user_level/create", { params });
// 添加/修改等级
let saveLevel = (data) => axios.post("/user/user_level", data);
// 删除等级
let deleteLevel = (id) => axios.put(`/user/user_level/delete/${id}`);

export default {
  // 管理
  getHeaders,
  getUserList,
  getUserLabel,
  userInsertForm,
  insertUser,
  getUserInfo,
  getUserOneInfo,
  // 分组
  getUserGroupList,
  deleteGroup,
  saveGroup,
  saveGroupForm,
  // 标签
  getUserLabelList,
  getLabelCateAll,
  labelForm,
  saveLabel,
  deleteLabel,
  labelCateCreateForm,
  labelCateEditForm,
  saveCate,
  editCate,
  deleteCate,
  // 等级
  getUserLevelList,
  setShow,
  levelCreateForm,
  saveLevel,
  deleteLevel,
};
